<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:decorate template="/views/home.xhtml">
	<ui:define name="centro">
		<h:form prependId="false">
			<div align="center">
				<h:panelGrid>
					<p:dataTable id="beneficios" rows="20" value="#{beneficioManagedbean.lista}" var="currentRow" >
 
						<p:column id="column1" headerText="Descricao">
							<div align="center"><h:outputText id="outDescricao" value="#{currentRow.descricao}" /></div>
						</p:column>

						<p:column id="column3" headerText="Ações">
                             <p:commandButton image="ui-icon-search" title="Detalhes" id="cmbDetalhes" onclick="dtlDialog.show()" 
                             		update="dtlDialog" type="button" ajax="false">
                             	<f:setPropertyActionListener value="#{currentRow}" target="#{beneficioManagedbean.selecionado}"/>
                             </p:commandButton>
                             &#160;&#160;
                             <p:commandButton image="ui-icon-close" title="Excluir" id="cmbExcluir" onclick="confirmacao.show()">
                             	<f:setPropertyActionListener value="#{currentRow}" target="#{coordenadasManagedbean.selecionado}" />
                             </p:commandButton> 
                         </p:column>
					</p:dataTable>
				</h:panelGrid>
				
				<h:panelGrid>
					<p:dialog header="Detalhes" widgetVar="dtlDialog" resizable="false" id="dtlDlg" modal="true" appendToBody="true">
						<h:panelGrid columns="2">
							<h:outputText id="outDescricao" value="Descrição: " style="color:#004276"/>
							<h:outputText id="inDescricao" value="#{beneficioManagedbean.selecionado.latitude}"/>					
						</h:panelGrid>
					</p:dialog>					
				</h:panelGrid>
				
				<h:panelGrid>
					<p:confirmDialog message="Deseja realmente excluir as coordenadas?" modal="true" widgetVar="confirmacao">
						<h:panelGrid columns="2">
							<p:commandButton value="Sim" action="#{beneficioManagedbean.excluir}" type="button" onclick="confirmacao.hide()"/>
							<p:commandButton value="Não" onclick="confirmacao.hide()" type="button"/>
						</h:panelGrid>
					</p:confirmDialog>
				</h:panelGrid>
			</div>
			
		</h:form>
	</ui:define>
</ui:decorate>

</html>